<!DOCTYPE html>
<html>

	<head>
		<title>链接</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
		<script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
	</head>
		<style>
			.container{
				height: 300px;
			}
			.row{
				margin-bottom: 15px;
			}
			.login{box-shadow: 0 0 10px #ccc;width:320px;margin:10% auto;padding:40px 30px;}
			.logins{width:100% !important;margin:30px auto 10px !important;display: block;}
			.form-control{display: inline-block !important;width:77% !important;}
			.form-group label{display: inline-block;width:23%;}
		</style>
	<body>
		<!-- <span id="uid" style="display: none">{:session('uids')}</span> -->
		<div class="login">
			<form action="" class="text-info">
				<div class="form-group">
					<label>用户名：</label><input type="text" name="username" class="form-control" id="username">
				</div>
				<div class="form-group">
					<label>密码：</label><input type="password" name="password" class="form-control" id="pwd">
				</div>
				<!-- <input type="button" name="" class="btn btn-info logins" onclick="getData('ugu')" value="登录"> -->
					<input type="button" name="" class="btn btn-info logins" onclick="getData()" value="登录">
			</form>
		</div>
		<script type="text/javascript">
		/*	var uid = $("#uid").text();
			if(uid != ""){
				window.location.href="{:url('autologin')}";
			}	*/
			function getData(){
				var username = $('#username').val();
				var password = $('#pwd').val();
				$.ajax({
					url:"{:url('index/login')}",
					type:'post',
					dataType:'json',
					data:{
						'username':username,
						'password':password
					},
					success:function(data){
						if(data.code == 1){
							window.location.href="{:url('left')}";
						}else{
							alert(data.msg);
						}
					}
				})
			}
		</script>
	</body>

</html>